#!/usr/bin/env ruby

LKP_SRC = ENV['LKP_SRC'] || File.dirname(File.dirname(File.realpath($PROGRAM_NAME)))

require "#{LKP_SRC}/lib/log"
require "#{LKP_SRC}/lib/statistics"
require "#{LKP_SRC}/lib/tests/stats"

stats = LKP::Stats.new

while (line = $stdin.gets)
  case line
  when /^-.*\(.*\)/
    stats.add_metric 'gauge.compression_level', line.split[0].gsub('-', '')
    stats.append_metric 'RATE.compression_MB/s', line.split[3]
    stats.append_metric 'RATE.decompression_MB/s', line.split[5]
  end
end

stats.dump
